<%@ Page Language="C#" MasterPageFile="~/master/public-regular.master" AutoEventWireup="true"
    CodeFile="register.aspx.cs" Inherits="register" Title="Untitled Page" %>

<%@ Register  Namespace="ECommerce.Library.Web" TagPrefix="ucc" %>
<%@ Register Src="~/controls/wucValidator.ascx" TagName="Validator" TagPrefix="wuc" %>
<%@ Register TagPrefix="recaptcha" Namespace="Recaptcha" Assembly="Recaptcha" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderNestedHeader"
    runat="Server">
    <script src="<%= SiteGlobals.BaseUrl %>javascript/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="<%= SiteGlobals.BaseUrl %>javascript/jquery.ui.core.js" type="text/javascript"></script>
    <script src="<%= SiteGlobals.BaseUrl %>javascript/datetime/jquery.ui.datepicker.js"
        type="text/javascript"></script>
    <link href="<%= SiteGlobals.BaseUrl %>javascript/datetime/jquery-ui-1.8.8.custom.css"
        rel="stylesheet" type="text/css" />
    <link href="<%= SiteGlobals.BaseUrl %>javascript/general/ApplicationCommon.js" rel="stylesheet"
        type="text/css" />
    <script src="<%= SiteGlobals.BaseUrl %>javascript/maskedinput/jquery.maskedinput-1.3.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#<%= tbxCompanyPhoneNumber.ClientID %>").mask("999-999-9999");
            $("#<%= tbxCompanyFaxNumber.ClientID %>").mask("999-999-9999");
            $("#<%= tbxBillingPhoneNumber.ClientID %>").mask("999-999-9999");
            $("#<%= tbxShippingPhoneNumber.ClientID %>").mask("999-999-9999");
            $("#<%= tbxContactFaxNumber.ClientID %>").mask("999-999-9999");
            $("#<%= tbxContactPhoneNumber.ClientID %>").mask("999-999-9999");

            $("#<%= tbxPersonalDateOfBirth.ClientID %>").mask("99/99/9999");
        });

        function ChangeTelephoneNo(txt) {
            var at = txt.value;
            $("#<%= tbxCompanyPhoneNumber.ClientID %>").val(at);
            $("#<%= tbxCompanyFaxNumber.ClientID %>").val(at);
            $("#<%= tbxBillingPhoneNumber.ClientID %>").val(at);
            $("#<%= tbxShippingPhoneNumber.ClientID %>").val(at);
            $("#<%= tbxContactFaxNumber.ClientID %>").val(at);
            $("#<%= tbxContactPhoneNumber.ClientID %>").val(at);

        }
        function ChangeEmailAddress(txt) {
            var at = txt.value;
            $("#<%= tbxPersonalEmailAddress.ClientID %>").val(at);
            $("#<%= tbxLoginConfirmEmail.ClientID %>").val(at);
            $("#<%= tbxBillingEmailAddress.ClientID %>").val(at);
            $("#<%= tbxShippingEmailAddress.ClientID %>").val(at);
        }
    
    </script>
</asp:Content>
<asp:Content ID="cntContent" ContentPlaceHolderID="cphMiddleContent" runat="Server">
    <div class="regular-pages inline registration-form">
        <ucc:ResponseMessage ID="uccResponseMessage" runat="server"></ucc:ResponseMessage>
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
            DisplayMode="BulletList" ShowMessageBox="true" HeaderText="Please correct the following:"
            ShowSummary="false" CssClass="Validator" />
        <br />
        <fieldset>
            <legend>Personal Details</legend>
            <label>
                First Name:</label>
            <asp:TextBox ID="tbxPersonalFirstName" runat="server" CssClass="text"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvPersonalFirstName" runat="server" ControlToValidate="tbxPersonalFirstName"
                ErrorMessage="First Name is required" Display="dynamic" SetFocusOnError="true"
                EnableClientScript="true">
            </asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator runat="server" ID="revFirstName" ControlToValidate="tbxPersonalFirstName"
                EnableClientScript="true" ErrorMessage="Incorrect Text Format" SetFocusOnError="true"
                ValidationExpression="^([a-zA-Z])+?(([- .])*?([a-zA-Z])*)*$">
            </asp:RegularExpressionValidator><br />
            <label>
                Last Name</label>
            <asp:TextBox ID="tbxPersonalLastName" runat="server" CssClass="text"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvPersonalLastName" runat="server" ControlToValidate="tbxPersonalLastName"
                ErrorMessage="Last Name is required" Display="dynamic" SetFocusOnError="true"
                EnableClientScript="true">
            </asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator runat="server" ID="revPersonalLastName" ControlToValidate="tbxPersonalLastName"
                EnableClientScript="true" ErrorMessage="Incorrect Name Format" SetFocusOnError="true"
                ValidationExpression="^([a-zA-Z])+?(([- .])*?([a-zA-Z])*)*$">
            </asp:RegularExpressionValidator><br />
            <label>
                Date of Birth:</label>
            <asp:TextBox ID="tbxPersonalDateOfBirth" runat="server" CssClass="text"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvPersonalDateOfBirth" runat="server" ControlToValidate="tbxPersonalDateOfBirth"
                ErrorMessage="Date of Birth is required" Display="dynamic" SetFocusOnError="true"
                EnableClientScript="true">
            </asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator runat="server" ID="revPersonalDateOfBirth" ControlToValidate="tbxPersonalDateOfBirth"
                EnableClientScript="true" ErrorMessage="Incorrect Date of Birth Format" SetFocusOnError="true"
                ValidationExpression="^(0[1-9]|1[0-2])/(0[1-9]|[1-2][0-9]|3[01])/([1-9][0-9][0-9][0-9])$">
            </asp:RegularExpressionValidator>
            <br />
            <label>
                Telephone Number</label>
            <asp:TextBox ID="tbxContactPhoneNumber" runat="server" CssClass="text" Text="" onchange="ChangeTelephoneNo(this)"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="tbxContactPhoneNumber"
                ErrorMessage="Telephone Required" Display="dynamic" SetFocusOnError="true" EnableClientScript="true">
            </asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator runat="server" ID="revContactPhoneNumber" ControlToValidate="tbxContactPhoneNumber"
                EnableClientScript="true" ErrorMessage="Incorrect Phone Format" SetFocusOnError="true"
                Display="Dynamic" ValidationExpression="^\d{3}-\d{3}-\d{4}$">
            </asp:RegularExpressionValidator><br />
            <label>
                Secondary Telephone Number</label>
            <asp:TextBox ID="tbxContactFaxNumber" runat="server" CssClass="text" Text=""></asp:TextBox>
            <br />
            <label>
                Email Address</label>
            <asp:TextBox ID="tbxPersonalEmailAddress" runat="server" CssClass="text" onchange="ChangeEmailAddress(this)"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvPersonalEmailAddress" runat="server" ControlToValidate="tbxPersonalEmailAddress"
                ErrorMessage="Email Address is required" Display="dynamic" SetFocusOnError="true"
                EnableClientScript="true">
            </asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator runat="server" ID="revPersonalEmailAddress" ControlToValidate="tbxPersonalEmailAddress"
                EnableClientScript="true" ErrorMessage="Incorrect Email Format" SetFocusOnError="true"
                ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
            </asp:RegularExpressionValidator><br />
            <label>
                Confirm Email</label>
            <asp:TextBox ID="tbxLoginConfirmEmail" runat="server" CssClass="text"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvLoginConfirmEmail" runat="server" ControlToValidate="tbxLoginConfirmEmail"
                ErrorMessage="Login Confirm Email Address is required" Display="dynamic" SetFocusOnError="true"
                EnableClientScript="true">
            </asp:RequiredFieldValidator>
            <asp:CompareValidator ID="cvLoginConfirmEmail" runat="server" ErrorMessage="Confirm Email does not match"
                ControlToValidate="tbxLoginConfirmEmail" ControlToCompare="tbxPersonalEmailAddress"
                EnableClientScript="true" Operator="Equal" Type="String" SetFocusOnError="true">
            </asp:CompareValidator><br />
            <label>
                Password</label>
            <asp:TextBox ID="tbxLoginPassword" runat="server" TextMode="password" CssClass="text"></asp:TextBox>
            <span style="font-size: x-small; font-style: italic; padding-left: 10px;">must be 6
                digits</span>
            <br />
            <asp:RequiredFieldValidator ID="rfvLoginPassword" runat="server" ControlToValidate="tbxLoginPassword"
                ErrorMessage="Login Password is required" Display="dynamic" SetFocusOnError="true"
                EnableClientScript="true">
            </asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator runat="server" ID="revLoginPassword" ControlToValidate="tbxLoginPassword"
                EnableClientScript="true" ErrorMessage="Length should be more than 6" SetFocusOnError="true"
                ValidationExpression="^[a-zA-Z0-9]{6,50}$">
            </asp:RegularExpressionValidator><br />
            <label>
                Confirm Password</label>
            <asp:TextBox ID="tbxLoginPasswordConfirm" runat="server" TextMode="password" CssClass="text"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvLoginPasswordConfirm" runat="server" ControlToValidate="tbxLoginPasswordConfirm"
                ErrorMessage="Login Confirm Password is required" Display="dynamic" SetFocusOnError="true"
                EnableClientScript="true">
            </asp:RequiredFieldValidator>
            <asp:CompareValidator ID="cvConfirmPassword" runat="server" ErrorMessage="Password does not match"
                ControlToValidate="tbxLoginPasswordConfirm" ControlToCompare="tbxLoginPassword"
                EnableClientScript="true" Operator="Equal" Type="String" SetFocusOnError="true">
            </asp:CompareValidator><br />
            <label>
                Gender</label>
            <div class="radio-inline">
                <asp:RadioButton ID="rbtMale" runat="server" GroupName="rbtGender" Checked="True" />
                <label>
                    Male</label>
                <asp:RadioButton ID="rbtFemale" runat="server" GroupName="rbtGender" />
                <label>
                    Female</label>
            </div>
        </fieldset>
        <fieldset>
            <legend>Company Information</legend>
            <label>
                Company Name</label>
            <asp:TextBox ID="tbxCompanyName" runat="server" CssClass="text"></asp:TextBox><br />
            <label>
                Telephone Number</label>
            <asp:TextBox ID="tbxCompanyPhoneNumber" runat="server" CssClass="text" Text=""></asp:TextBox><br />
            <label>
                Secondary Telephone Number</label>
            <asp:TextBox ID="tbxCompanyFaxNumber" runat="server" CssClass="text" Text=""></asp:TextBox>
        </fieldset>
        <fieldset>
            <legend>Credit Cards Billing Address</legend>
            <label>
                First Name</label>
            <asp:TextBox ID="tbxBillingFirstName" runat="server" CssClass="text"></asp:TextBox><br />
            <label>
                Last Name</label>
            <asp:TextBox ID="tbxBillingLastName" runat="server" CssClass="text"></asp:TextBox><br />
            <label>
                Email Address</label>
            <asp:TextBox ID="tbxBillingEmailAddress" runat="server" CssClass="text"></asp:TextBox>
            <asp:RegularExpressionValidator runat="server" ID="revBillingEmailAddress" ControlToValidate="tbxBillingEmailAddress"
                EnableClientScript="true" ErrorMessage="Incorrect Email Format" SetFocusOnError="true"
                ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
            </asp:RegularExpressionValidator><br />
            <label>
                Telephone Number</label>
            <asp:TextBox ID="tbxBillingPhoneNumber" runat="server" CssClass="text" Text=""></asp:TextBox>
            <asp:RegularExpressionValidator runat="server" ID="revBillingPhoneNumber" ControlToValidate="tbxBillingPhoneNumber"
                EnableClientScript="true" ErrorMessage="Incorrect Phone Format" SetFocusOnError="true"
                ValidationExpression="^\d{3}-\d{3}-\d{4}$">
            </asp:RegularExpressionValidator><br />
            <label>
                Address Line 1</label>
            <asp:TextBox ID="tbxBillingAddressLine1" runat="server" CssClass="text"></asp:TextBox><br />
            <label>
                Address Line 2</label>
            <asp:TextBox ID="tbxBillingAddressLine2" runat="server" CssClass="text"></asp:TextBox><br />
            <label>
                City</label>
            <asp:TextBox ID="tbxBillingCity" runat="server" CssClass="text"></asp:TextBox><br />
            <label>
                State</label>
            <ucc:StateDropDownList ID="uccBillingState" runat="server" UseFirstItem="true" FirstItemText="None / Other"
                FirstItemValue="NA">
            </ucc:StateDropDownList>
            <br />
            <label>
                Zip Code</label>
            <asp:TextBox ID="tbxBillingZipCode" runat="server" CssClass="text" Width="45px" MaxLength="5"></asp:TextBox>
            <asp:RegularExpressionValidator runat="server" ID="revBillingZipCode" ControlToValidate="tbxBillingZipCode"
                EnableClientScript="true" ErrorMessage="Incorrect Name Format" SetFocusOnError="true"
                ValidationExpression="^\d{5}$">
            </asp:RegularExpressionValidator><br />
            <label>
                Country</label>
            <ucc:CountryDropDownList ID="uccBillingCountry" runat="server">
            </ucc:CountryDropDownList>
            <br />
        </fieldset>
        <fieldset>
            <legend>Shipping Address </legend>
            <div class="form-statement">
                <input type="checkbox" id="cbxCopyBillingInfo" onclick="javascript:CopyBillingInfo()" />
                <label>
                    Shipping same as Billing</label>
            </div>
            <label>
                First Name</label>
            <asp:TextBox ID="tbxShippingFirstName" runat="server" CssClass="text"></asp:TextBox><br />
            <label>
                Last Name</label>
            <asp:TextBox ID="tbxShippingLastName" runat="server" CssClass="text"></asp:TextBox><br />
            <label>
                Email Address</label>
            <asp:TextBox ID="tbxShippingEmailAddress" runat="server" CssClass="text"></asp:TextBox>
            <asp:RegularExpressionValidator runat="server" ID="revShippingEmailAddress" ControlToValidate="tbxShippingEmailAddress"
                EnableClientScript="true" ErrorMessage="Incorrect Email Format" SetFocusOnError="true"
                ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
            </asp:RegularExpressionValidator><br />
            <label>
                Telephone Number</label>
            <asp:TextBox ID="tbxShippingPhoneNumber" runat="server" CssClass="text" Text=""></asp:TextBox>
            <asp:RegularExpressionValidator runat="server" ID="revShippingPhoneNumber" ControlToValidate="tbxShippingPhoneNumber"
                EnableClientScript="true" ErrorMessage="Incorrect Phone Format" SetFocusOnError="true"
                ValidationExpression="^\d{3}-\d{3}-\d{4}$">
            </asp:RegularExpressionValidator><br />
            <label>
                Address Line 1</label>
            <asp:TextBox ID="tbxShippingAddressLine1" runat="server" CssClass="text"></asp:TextBox><br />
            <label>
                Address Line 2</label>
            <asp:TextBox ID="tbxShippingAddressLine2" runat="server" CssClass="text"></asp:TextBox><br />
            <label>
                City</label>
            <asp:TextBox ID="tbxShippingCity" runat="server" CssClass="text"></asp:TextBox><br />
            <label>
                State</label>
            <ucc:StateDropDownList ID="uccShippingState" runat="server" UseFirstItem="true" Style="width: 155px;
                background-color: rgb(255, 255, 160);" FirstItemText="None / Other" FirstItemValue="NA">
            </ucc:StateDropDownList>
            <br />
            <label>
                Zip Code</label>
            <asp:TextBox ID="tbxShippingZipCode" runat="server" CssClass="text" size="5"></asp:TextBox>
            <asp:RegularExpressionValidator runat="server" ID="revShippingZipCode" ControlToValidate="tbxShippingZipCode"
                EnableClientScript="true" ErrorMessage="Incorrect Name Format" SetFocusOnError="true"
                ValidationExpression="^\d{5}$">
            </asp:RegularExpressionValidator><br />
            <label>
                Country</label>
            <ucc:CountryDropDownList ID="uccShippingCountry" runat="server">
            </ucc:CountryDropDownList>
        </fieldset>
        <fieldset>
            <legend>Security Verification </legend>
            <div class="form-right-content">
            <asp:Panel ID="pnlCaptcha" runat="server" DefaultButton="imbRegister">
                <recaptcha:RecaptchaControl runat="server" ID="recaptcha1" Theme="red" PublicKey="6LdPowUAAAAAAB4xPXbjxPxe_6mXMEkUkBFCtqb5"
                    PrivateKey="6LdPowUAAAAAALGLe-lAcCvskHZNBeCH7UE818Ox" />
                    </asp:Panel>
                <asp:Button ID="imbRegister" runat="server" OnClick="imbRegister_Click" Text="Create Account"
                    CssClass="button green" />
                <asp:Button ID="imbReset" runat="server" CausesValidation="false" OnClientClick="javascript:ResetFields();return false;"
                    CssClass="button gray btn-dim" Text="Reset" />
            </div>
        </fieldset>
    </div>
    <script language="javascript" type="text/javascript">
        function ResetFields() {
            $('<%= tbxPersonalFirstName.ClientID %>').value = '';
            $('<%= tbxPersonalLastName.ClientID %>').value = '';
            $('<%= tbxPersonalDateOfBirth.ClientID %>').value = '';
            $('<%= tbxPersonalEmailAddress.ClientID %>').value = '';
            $('<%= tbxContactPhoneNumber.ClientID %>').value = '';
            $('<%= tbxContactFaxNumber.ClientID %>').value = '';
            $('<%= tbxCompanyName.ClientID %>').value = '';
            $('<%= tbxCompanyPhoneNumber.ClientID %>').value = '';
            $('<%= tbxCompanyFaxNumber.ClientID %>').value = '';
            $('<%= tbxBillingFirstName.ClientID %>').value = '';
            $('<%= tbxBillingLastName.ClientID %>').value = '';
            $('<%= tbxBillingAddressLine1.ClientID %>').value = '';
            $('<%= tbxBillingAddressLine2.ClientID %>').value = '';
            $('<%= tbxBillingCity.ClientID %>').value = '';
            $('<%= tbxBillingZipCode.ClientID %>').value = '';
            $('<%= tbxShippingFirstName.ClientID %>').value = '';
            $('<%= tbxShippingLastName.ClientID %>').value = '';
            $('<%= tbxShippingAddressLine1.ClientID %>').value = '';
            $('<%= tbxShippingAddressLine2.ClientID %>').value = '';
            $('<%= tbxShippingCity.ClientID %>').value = '';
            $('<%= tbxShippingZipCode.ClientID %>').value = '';
            $('<%= tbxLoginPassword.ClientID %>').value = '';
            $('<%= tbxLoginConfirmEmail.ClientID %>').value = '';
            $('<%=uccBillingState.ClientID%>').options[0].selected = true;
            $('<%=uccBillingCountry.ClientID%>').options[0].selected = true;
            $('<%=uccShippingState.ClientID%>').options[0].selected = true;
            $('<%=uccShippingCountry.ClientID%>').options[0].selected = true;
            $('cbxCopyBillingInfo').checked = false;
        }

        function CopyBillingInfo() {
            if ($("#cbxCopyBillingInfo").attr('checked')) {
                $("#<%= tbxShippingFirstName.ClientID %>").val($("#<%= tbxBillingFirstName.ClientID %>").val());
                $("#<%= tbxShippingLastName.ClientID %>").val($("#<%= tbxBillingLastName.ClientID %>").val());
                $("#<%= tbxShippingPhoneNumber.ClientID %>").val($("#<%= tbxBillingPhoneNumber.ClientID %>").val());
                $("#<%= tbxShippingEmailAddress.ClientID %>").val($("#<%= tbxBillingEmailAddress.ClientID %>").val());
                $("#<%= tbxShippingAddressLine1.ClientID %>").val($("#<%= tbxBillingAddressLine1.ClientID %>").val());
                $("#<%= tbxShippingAddressLine2.ClientID %>").val($("#<%= tbxBillingAddressLine2.ClientID %>").val());
                $("#<%= tbxShippingCity.ClientID %>").val($("#<%= tbxBillingCity.ClientID %>").val());
                $("#<%= tbxShippingZipCode.ClientID %>").val($("#<%= tbxBillingZipCode.ClientID %>").val());
                $("#<%=uccShippingState.ClientID%>").val($("#<%=uccBillingState.ClientID%>").val());
                $("#<%=uccShippingCountry.ClientID%>").val($("#<%=uccBillingCountry.ClientID%>").val());
            }
            else {
                $("#<%= tbxShippingFirstName.ClientID %>").val('');
                $("#<%= tbxShippingLastName.ClientID %>").val('');
                $("#<%= tbxShippingPhoneNumber.ClientID %>").val('');
                $("#<%= tbxShippingEmailAddress.ClientID %>").val('');
                $("#<%= tbxShippingAddressLine1.ClientID %>").val('');
                $("#<%= tbxShippingAddressLine2.ClientID %>").val('');
                $("#<%= tbxShippingCity.ClientID %>").val('');
                $("#<%= tbxShippingZipCode.ClientID %>").val('');
                $("#<%=uccShippingState.ClientID%>").val('');
                $("#<%=uccShippingCountry.ClientID%>").val('');
            }
        }
        $(function () {
//            $("#<%= tbxPersonalDateOfBirth.ClientID %>#").datepicker({
//                changeMonth: true,
//                changeYear: true
//            });
        });

        function clearTextHere(field, initialText) {
            if (field != null) {
                //                alert(field.toString());
                if (field.value == initialText) {
                    field.value = "";
                    field.style.color = 'black';
                }
            }
        }
    </script>
</asp:Content>
